﻿using System.Windows;
using System.Windows.Controls;
using Microsoft.Practices.Composite.Presentation.Commands;

namespace Core.Infrastructure.CommandExtensions
{
    public class ItemsControlDropCommandBehavior : CommandBehaviorBase<ItemsControl>
    {
        public ItemsControlDropCommandBehavior(ItemsControl targetObject)
            : base(targetObject)
        {
            targetObject.Drop += new DragEventHandler(ItemsControlDrop);
        }

        private void ItemsControlDrop(object sender, DragEventArgs e)
        {
            ((sender as ItemsControl).Items[0] as Grid).Children[0].Opacity=1;
            this.CommandParameter = e;
            base.ExecuteCommand();
        }
    }
}
